<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- const arr = [3,2,1,4,5]
    let temp = arr[2]
    arr[2] = arr[0]
    arr[0] = temp
    将数组中的  元素1  与  元素3 调换位置-->
<SCRIPT type="text/javascript">
    const arr = [3,2,1,4,5];
    let arr1 =arr.slice();
    arr1[0]=arr[2];
    arr1[2]=arr[0];
    console.log(arr1);
</SCRIPT>
<!--使用冒泡排序（从大到小）：  [90,65,78,66,48,39,92,73]  使用数组解构的方法交换变量-->
<script type="text/javascript">
    const array =[90,65,78,66,48,39,92,73] ;
        for (let i = 0; i < array.length-1; i++) {
            for (let j = 0; j < array.length-1; j++) {
            if (array[j]<array[j+1]) {
                    [array[j] ,array[j+1]]=[array[j+1],array[j]]
            } 
        }
    }
    console.log(array);
</script>

<!--var text ='I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.'
//将上述字符串去除标点空格后统计有多少个单词-->

<script type="text/javascript">
    var text ='I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.';
    console.log(text.trim('',','));
</script>

<!--
1.移除第一个元素87，并在开头添加 元素86
2.移除最后一个元素43， 并在末尾添加1
3.在 70 65 之间插入 元素 68
4.删除元素65
5.使用map返回一个新的数组new_arr，要求新数组new_arr比原来数组大2
6.筛选数组new_arr返回new_arr1,要求new_arr1: 能被2整除-->
<script type="text/javascript">
const arry = [87,85,74,70,65,59,43];
arr.shift(1);
arr.unshift(86)
console.log(arr);
</script> 

<script type="text/javascript">
const arr1 = [87,85,74,70,65,59,43];
arr1.pop(7);
arr1.push(1);
console.log(arr1);
</script> 

<script type="text/javascript">
const arr2 = [87,85,74,70,65,59,43];
arr2.splice(3,0,68)
console.log(arr2);
</script> 

<script type="text/javascript">
const arr3 = [87,85,74,70,65,59,43];
arr3.splice(4,1);
console.log(arr3);
</script>

<script type="text/javascript">
    const arr4 = [87,85,74,70,65,59,43];
    const new_arr=arr4.map(new_arr=arr4>2);
    console.log(new_arr);
</script>

<script type="text/javascript">
    const arr5 = [87,85,74,70,65,59,43];
    const new_arr1=arr5.set()
    console.log(new_arr);
</script>

</body>
</html>